Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-vars-ponyfill

Package Overview
Dependencies
Maintainers
1
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-vars-ponyfill

Client-side support for CSS custom properties (aka "CSS variables") in legacy and modern browsers

  • 2.4.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is css-vars-ponyfill?

The css-vars-ponyfill package is a JavaScript library that provides a polyfill for CSS custom properties (CSS variables) in browsers that do not support them natively. It allows developers to use CSS variables in their stylesheets and ensures compatibility across all browsers, including older versions of Internet Explorer.

What are css-vars-ponyfill's main functionalities?

Basic Usage

This is the simplest way to use css-vars-ponyfill. By calling the cssVars() function, the library will automatically find and process all CSS variables in your stylesheets and apply the necessary polyfills to ensure compatibility.

cssVars();

Custom Configuration

This example demonstrates how to use css-vars-ponyfill with custom configuration options. You can specify various parameters such as the root element, whether to include shadow DOM, which elements to include or exclude, custom variables, and callback functions for different stages of the process.

cssVars({
  rootElement: document,
  shadowDOM: false,
  include: 'style,link[rel=stylesheet]',
  exclude: '',
  variables: {},
  onlyLegacy: true,
  preserveStatic: true,
  preserveVars: false,
  silent: false,
  updateDOM: true,
  updateURLs: true,
  watch: false,
  onBeforeSend: function(xhr, elm, url) {},
  onSuccess: function(cssText, elm, url) {},
  onWarning: function(message) {},
  onError: function(message, elm, xhr, url) {},
  onComplete: function(cssText, styleElms, cssVariables, benchmark) {}
});

Dynamic Updates

By setting the watch option to true, css-vars-ponyfill will automatically reprocess CSS variables whenever changes are detected in the DOM. This is useful for applications where styles are dynamically updated or added.

cssVars({
  watch: true
});

Other packages similar to css-vars-ponyfill

Keywords

FAQs

Package last updated on 05 Mar 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc